<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>VarNode - Three.js Docs</title>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<script src="../scripts/highlight.min.js"></script>
	<link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
	<link type="text/css" rel="stylesheet" href="../styles/page.css">
</head>
<body>
		<p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Node.html">Node</a> → </p>
	<h1 translate="no">VarNode</h1>
		<section>
			<header>
				<div class="class-description"><p>Class for representing shader variables as nodes. Variables are created from
existing nodes like the following:</p></div>
				<h2>Code Example</h2>
				<div translate="no"><pre><code class="language-js">const depth = sampleDepth( uvNode ).toVar( 'depth' );
</code></pre></div>
			</header>
			<article>
				<div class="container-overview">
					<h2>Constructor</h2>
					<h3 class="name name-method" id="VarNode" translate="no">new <a href="#VarNode">VarNode</a><span class="signature">( node : <span class="param-type"><a href="Node.html">Node</a></span>, name : <span class="param-type">string</span>, readOnly : <span class="param-type">boolean</span> )</span> </h3>
					<div class="method">
						<div class="description">
							<p>Constructs a new variable node.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>node</strong>
									</td>
									<td class="description last">
										<p>The node for which a variable should be created.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>name</strong>
									</td>
									<td class="description last">
										<p>The name of the variable in the shader.</p>
										<p>Default is <code>null</code>.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>readOnly</strong>
									</td>
									<td class="description last">
										<p>The read-only flag.</p>
										<p>Default is <code>false</code>.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<h2 class="subsection-title">Properties</h2>
				<div class="member">
					<h3 class="name" id="global" translate="no">.<a href="#global">global</a><span class="type-signature"> : boolean</span> </h3>
					<div class="description">
						<p><code>VarNode</code> sets this property to <code>true</code> by default.</p>
						<p>Default is <code>true</code>.</p>
					</div>
						<dl class="details">
							<dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#global">Node#global</a></dt>
						</dl>
				</div>
				<div class="member">
					<h3 class="name" id="intent" translate="no">.<a href="#intent">intent</a><span class="type-signature"> : boolean</span> </h3>
					<div class="description">
						<p>This flag is used to indicate that this node is used for intent.</p>
						<p>Default is <code>false</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="isVarNode" translate="no">.<a href="#isVarNode">isVarNode</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
					<div class="description">
						<p>This flag can be used for type testing.</p>
						<p>Default is <code>true</code>.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="name" translate="no">.<a href="#name">name</a><span class="type-signature"> : string</span> </h3>
					<div class="description">
						<p>The name of the variable in the shader. If no name is defined,
the node system auto-generates one.</p>
						<p>Default is <code>null</code>.</p>
					</div>
						<dl class="details">
							<dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#name">Node#name</a></dt>
						</dl>
				</div>
				<div class="member">
					<h3 class="name" id="node" translate="no">.<a href="#node">node</a><span class="type-signature"> : <a href="Node.html">Node</a></span> </h3>
					<div class="description">
						<p>The node for which a variable should be created.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="parents" translate="no">.<a href="#parents">parents</a><span class="type-signature"> : boolean</span> </h3>
					<div class="description">
						<p>Add this flag to the node system to indicate that this node require parents.</p>
						<p>Default is <code>true</code>.</p>
					</div>
						<dl class="details">
							<dt class="tag-overrides"><strong>Overrides:</strong> <a href="Node.html#parents">Node#parents</a></dt>
						</dl>
				</div>
				<div class="member">
					<h3 class="name" id="readOnly" translate="no">.<a href="#readOnly">readOnly</a><span class="type-signature"> : boolean</span> </h3>
					<div class="description">
						<p>The read-only flag.</p>
						<p>Default is <code>false</code>.</p>
					</div>
				</div>
				<h2 class="subsection-title">Methods</h2>
					<h3 class="name name-method" id="getIntent" translate="no">.<a href="#getIntent">getIntent</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
					<div class="method">
						<div class="description">
							<p>Returns the intent flag of this node.</p>
						</div>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The intent flag.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="isIntent" translate="no">.<a href="#isIntent">isIntent</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
					<div class="method">
						<div class="description">
							<p>Checks if this node is used for intent.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>builder</strong>
									</td>
									<td class="description last">
										<p>The node builder.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> Whether this node is used for intent.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="setIntent" translate="no">.<a href="#setIntent">setIntent</a><span class="signature">( value : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="VarNode.html">VarNode</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Sets the intent flag for this node.</p>
<p>This flag is used to indicate that this node is used for intent
and should not be built directly. Instead, it is used to indicate that
the node should be treated as a variable intent.</p>
<p>It's useful for assigning variables without needing creating a new variable node.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>value</strong>
									</td>
									<td class="description last">
										<p>The value to set for the intent flag.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> This node.</dt>
						</dl>
					</div>
				<h2 class="subsection-title">Source</h2>
				<p>
					<a href="https://github.com/mrdoob/three.js/blob/master/src/nodes/core/VarNode.js" translate="no" target="_blank" rel="noopener">src/nodes/core/VarNode.js</a>
				</p>
			</article>
		</section>
<script src="../scripts/linenumber.js"></script>
<script src="../scripts/page.js"></script>
</body>
</html>